<?php
$baseUrl="http://demo.dataoke.com/index.php";
$qry=$_SERVER['REQUEST_URI'];
if(strpos($qry,'=')){
 if(strpos($qry,'?')!==false) {
    $q = parse_url($qry);
    $qry ="?". $q['query'];
 }
}else{
  $qry="";
}
$url= $baseUrl.$qry;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
if (!isset($_GET['pid'])){ die($result);};
$r=$_GET['r'];
switch ($r)
{
case "index/everybuy":
  $o=json_decode($result);
  $o -> data -> url =$o -> data -> url."&pid=".$_GET['pid'];
  die(json_encode($o));
  break;
default:
   $target=".php?r=".$r;
   $result= str_ireplace('index'.$target,'dtk'.$target, $result);
   die(str_ireplace('?r=','?pid='. $_GET['pid'] . '&r=', $result));
   break;
}





